import type { TWeek } from "@/container/Course/component/OrderTime/constants";

export interface IPropChild {
  children: React.ReactNode;
}
export interface IUser {
  id: string;
  tel?: string;
  name?: string;
  desc?: string;
  avatar?: string;
  refetchHandler?: () => void;
  currentOrg?: string;
}

export interface IPage {
  pageNum: number;
  pageSize: number;
  total: number;
}
export interface IMedia {
  id: string;
  url: string;
  remark: string;
}
/**
 * 门店
 */
export interface IOrganization {
  id: string;
  orgFrontImg?: IMedia[];
  orgRoomImg?: IMedia[];
  orgOtherImg?: IMedia[];
  name?: string;
  logo?: string;
  tags?: string;
  description?: string;
  address?: string;
  longitude?: string;
  latitude?: string;
  tel?: string;
  identityCardFrontImg?: string;
  identityCardBackImg?: string;
  businessLicense?: string;
}

// 可以把IOrganization的所有属性转为带?的选填项
export type TBaseOrganization = Partial<IOrganization>;

export type TOrgsQuery = {
  [key: string]: { __typename?: "Query"; data: IOrganization[]; page: IPage };
};
export type TOrgQuery = {
  [key: string]: { __typename?: "Query"; data: IOrganization };
};

/**
 * 学员
 */
export interface IStudent {
  id: string;
  name?: string;
  tel?: string;
  desc?: string;
  avatar?: string;
  account?: string;
}
export type TBaseStudent = Partial<IStudent>;
export type TStudentsQuery = {
  [key: string]: { __typename?: "Query"; data: IStudent[]; page: IPage };
};
/**
 * 课程
 */
export interface IOrderTime {
  key: number;
  startTime: string;
  endTime: string;
}
export interface IWeekCourse {
  week: TWeek;
  orderTime: IOrderTime[];
}
export interface ICourse {
  id: string;
  name?: string;
  desc?: string;
  group?: string;
  baseAbility?: string;
  limitNumber: number;
  duration?: number;
  reserveInfo?: string;
  refundInfo?: string;
  otherInfo?: string;
  reducibleTime?: IWeekCourse[];
}
export type TBaseCourse = Partial<ICourse>;
export type TCoursesQuery = {
  [key: string]: { __typename?: "Query"; data: ICourse[]; page: IPage };
};
export type TCourseQuery = {
  [key: string]: { __typename?: "Query"; data: ICourse };
};

export interface ICard {
  id: string;
  name?: string;
  type?: string;
  time?: number;
  validityDay?: number;
  course?:ICourse;
}

export type TBaseCard = Partial<ICard>;
export type TCardsQuery = {
  [key: string]: { __typename?: "Query"; data: ICard[]; page: IPage };
};
export type TCardQuery = {
  [key: string]: { __typename?: "Query"; data: ICard };
};

export interface IProduct {
  id: string;
  name?: string;
  desc?: string;
  stock?: number;
  curStock?: number;
  buyNumber?: number;
  limitBuyNumber?: number;
  coverUrl?: string;
  bannerUrl?: string;
  orginalPrice?: number;
  preferentialPrice?: number;
  cards?:ICard[];
}
export type TBaseProduct = Partial<IProduct>;
export type TProductsQuery = {
  [key: string]: { __typename?: "Query"; data: IProduct[]; page: IPage };
};
export type TProductQuery = {
  [key: string]: { __typename?: "Query"; data: IProduct };
};
